package com.insideClass;

import com.insideClass.typeinfo.Pet;
import com.insideClass.typeinfo.Pets;

import java.util.*;

/**
 * @author 13699
 */
public class CrossContainerIteration {
    public static void display(Iterator<Pet> it){
        while (it.hasNext()){
            Pet p=it.next();
            System.out.println(p.id()+":"+" ");
        }
        System.out.println();
    }

    public static void main(String[] args) {
        ArrayList<Pet> pets= Pets.arrayList(8);
        LinkedList<Pet> petsll=new LinkedList<>(pets);
        HashSet<Pet> petsHS=new HashSet<>(pets);
        TreeSet<Pet> petsTS=new TreeSet<>(pets);
        display(pets.iterator());
        display(petsll.iterator());
        display(petsHS.iterator());
        display(petsTS.iterator());
    }
}
